<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>C++11 Algorithms</title>
<link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="The Boost Algorithm Library">
<link rel="up" href="../index.html" title="The Boost Algorithm Library">
<link rel="prev" href="../the_boost_algorithm_library/Searching/KnuthMorrisPratt.html" title="Knuth-Morris-Pratt Search">
<link rel="next" href="CXX14.html" title="C++14 Algorithms">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
<td align="center"><a href="../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../the_boost_algorithm_library/Searching/KnuthMorrisPratt.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="CXX14.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="algorithm.CXX11"></a><a class="link" href="CXX11.html" title="C++11 Algorithms">C++11 Algorithms</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms"></a></span></dt>
<dd><dl>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of">all_of</a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of">any_of</a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of">none_of</a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of">one_of</a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted">is_sorted
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned">is_partitioned
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation">is_permutation
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point">partition_point
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.partition_copy">partition_copy
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.copy_if">copy_if
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.copy_n">copy_n
        </a></span></dt>
<dt><span class="section"><a href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.iota">iota
        </a></span></dt>
</dl></dd>
</dl></div>
<div class="section">
<div class="titlepage"></div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of" title="all_of">all_of</a>
</h4></div></div></div>
<p>
          The header file 'boost/algorithm/cxx11/all_of.hpp' contains four variants
          of a single algorithm, <code class="computeroutput"><span class="identifier">all_of</span></code>.
          The algorithm tests all the elements of a sequence and returns true if
          they all share a property.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">all_of</span></code> takes
          a sequence and a predicate. It will return true if the predicate returns
          true when applied to every element in the sequence.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">all_of_equal</span></code>
          takes a sequence and a value. It will return true if every element in the
          sequence compares equal to the passed in value.
        </p>
<p>
          Both routines come in two forms; the first one takes two iterators to define
          the range. The second form takes a single range parameter, and uses Boost.Range
          to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.interface">interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">all_of</span></code> returns
          true if the predicate returns true for every item in the sequence. There
          are two versions; one takes two iterators, and the other takes a range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">all_of</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">all_of</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          The function <code class="computeroutput"><span class="identifier">all_of_equal</span></code>
          is similar to <code class="computeroutput"><span class="identifier">all_of</span></code>, but
          instead of taking a predicate to test the elements of the sequence, it
          takes a value to compare against.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">all_of_equal</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">all_of_equal</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>

<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">algorithm</span><span class="special">;</span>
<span class="identifier">all_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">all_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">all_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">all_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// empty range</span>
<span class="identifier">all_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">all_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">4</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">all_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="number">99</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">all_of</span></code> and <code class="computeroutput"><span class="identifier">all_of_equal</span></code> work on all iterators except
          output iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.complexity">Complexity</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">all_of</span></code>
          and <code class="computeroutput"><span class="identifier">all_of_equal</span></code> run in
          <span class="emphasis"><em>O(N)</em></span> (linear) time; that is, they compare against
          each element in the list once. If any of the comparisons fail, the algorithm
          will terminate immediately, without examining the remaining members of
          the sequence.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">all_of</span></code>
          and <code class="computeroutput"><span class="identifier">all_of_equal</span></code> take their
          parameters by value or const reference, and do not depend upon any global
          state. Therefore, all the routines in this file provide the strong exception
          guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.all_of.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The routine <code class="computeroutput"><span class="identifier">all_of</span></code>
              is also available as part of the C++11 standard.
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">all_of</span></code> and <code class="computeroutput"><span class="identifier">all_of_equal</span></code> both return true for
              empty ranges, no matter what is passed to test against. When there
              are no items in the sequence to test, they all satisfy the condition
              to be tested against.
            </li>
<li class="listitem">
              The second parameter to <code class="computeroutput"><span class="identifier">all_of_value</span></code>
              is a template parameter, rather than deduced from the first parameter
              (<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">InputIterator</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>) because that allows more
              flexibility for callers, and takes advantage of built-in comparisons
              for the type that is pointed to by the iterator. The function is defined
              to return true if, for all elements in the sequence, the expression
              <code class="computeroutput"><span class="special">*</span><span class="identifier">iter</span>
              <span class="special">==</span> <span class="identifier">val</span></code>
              evaluates to true (where <code class="computeroutput"><span class="identifier">iter</span></code>
              is an iterator to each element in the sequence)
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of" title="any_of">any_of</a>
</h4></div></div></div>
<p>
          The header file 'boost/algorithm/cxx11/any_of.hpp' contains four variants
          of a single algorithm, <code class="computeroutput"><span class="identifier">any_of</span></code>.
          The algorithm tests the elements of a sequence and returns true if any
          of the elements has a particular property.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">any_of</span></code> takes
          a sequence and a predicate. It will return true if the predicate returns
          true for any element in the sequence.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">any_of_equal</span></code>
          takes a sequence and a value. It will return true if any element in the
          sequence compares equal to the passed in value.
        </p>
<p>
          Both routines come in two forms; the first one takes two iterators to define
          the range. The second form takes a single range parameter, and uses Boost.Range
          to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.interface">interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">any_of</span></code> returns
          true if the predicate returns true any item in the sequence. There are
          two versions; one takes two iterators, and the other takes a range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">any_of</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">any_of</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          The function <code class="computeroutput"><span class="identifier">any_of_equal</span></code>
          is similar to <code class="computeroutput"><span class="identifier">any_of</span></code>, but
          instead of taking a predicate to test the elements of the sequence, it
          takes a value to compare against.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">any_of_equal</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">any_of_equal</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>

<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">algorithm</span><span class="special">;</span>
<span class="identifier">any_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">any_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">any_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">4</span><span class="special">,</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">any_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>  <span class="comment">// empty range</span>
<span class="identifier">any_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">any_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">any_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="number">99</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">any_of</span></code> and <code class="computeroutput"><span class="identifier">any_of_equal</span></code> work on all iterators except
          output iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.complexity">Complexity</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">any_of</span></code>
          and <code class="computeroutput"><span class="identifier">any_of_equal</span></code> run in
          <span class="emphasis"><em>O(N)</em></span> (linear) time; that is, they compare against
          each element in the list once. If any of the comparisons succeed, the algorithm
          will terminate immediately, without examining the remaining members of
          the sequence.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">any_of</span></code>
          and <code class="computeroutput"><span class="identifier">any_of_equal</span></code> take their
          parameters by value or const reference, and do not depend upon any global
          state. Therefore, all the routines in this file provide the strong exception
          guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.any_of.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The routine <code class="computeroutput"><span class="identifier">any_of</span></code>
              is also available as part of the C++11 standard.
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">any_of</span></code> and <code class="computeroutput"><span class="identifier">any_of_equal</span></code> both return false for
              empty ranges, no matter what is passed to test against.
            </li>
<li class="listitem">
              The second parameter to <code class="computeroutput"><span class="identifier">any_of_value</span></code>
              is a template parameter, rather than deduced from the first parameter
              (<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">InputIterator</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>) because that allows more
              flexibility for callers, and takes advantage of built-in comparisons
              for the type that is pointed to by the iterator. The function is defined
              to return true if, for any element in the sequence, the expression
              <code class="computeroutput"><span class="special">*</span><span class="identifier">iter</span>
              <span class="special">==</span> <span class="identifier">val</span></code>
              evaluates to true (where <code class="computeroutput"><span class="identifier">iter</span></code>
              is an iterator to each element in the sequence)
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of" title="none_of">none_of</a>
</h4></div></div></div>
<p>
          The header file 'boost/algorithm/cxx11/none_of.hpp' contains four variants
          of a single algorithm, <code class="computeroutput"><span class="identifier">none_of</span></code>.
          The algorithm tests all the elements of a sequence and returns true if
          they none of them share a property.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">none_of</span></code> takes
          a sequence and a predicate. It will return true if the predicate returns
          false when applied to every element in the sequence.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">none_of_equal</span></code>
          takes a sequence and a value. It will return true if none of the elements
          in the sequence compare equal to the passed in value.
        </p>
<p>
          Both routines come in two forms; the first one takes two iterators to define
          the range. The second form takes a single range parameter, and uses Boost.Range
          to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.interface">interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">none_of</span></code> returns
          true if the predicate returns false for every item in the sequence. There
          are two versions; one takes two iterators, and the other takes a range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">none_of</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">none_of</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          The function <code class="computeroutput"><span class="identifier">none_of_equal</span></code>
          is similar to <code class="computeroutput"><span class="identifier">none_of</span></code>,
          but instead of taking a predicate to test the elements of the sequence,
          it takes a value to compare against.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">none_of_equal</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">none_of_equal</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>

<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">algorithm</span><span class="special">;</span>

<span class="identifier">none_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">none_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">none_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">4</span><span class="special">,</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">none_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// empty range</span>
<span class="identifier">none_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">none_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">none_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="number">99</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">none_of</span></code> and <code class="computeroutput"><span class="identifier">none_of_equal</span></code> work on all iterators except
          output iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.complexity">Complexity</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">none_of</span></code>
          and <code class="computeroutput"><span class="identifier">none_of_equal</span></code> run in
          <span class="emphasis"><em>O(N)</em></span> (linear) time; that is, they compare against
          each element in the list once. If any of the comparisons succeed, the algorithm
          will terminate immediately, without examining the remaining members of
          the sequence.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">none_of</span></code>
          and <code class="computeroutput"><span class="identifier">none_of_equal</span></code> take
          their parameters by value or const reference, and do not depend upon any
          global state. Therefore, all the routines in this file provide the strong
          exception guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.none_of.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The routine <code class="computeroutput"><span class="identifier">none_of</span></code>
              is also available as part of the C++11 standard.
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">none_of</span></code> and <code class="computeroutput"><span class="identifier">none_of_equal</span></code> both return true for
              empty ranges, no matter what is passed to test against.
            </li>
<li class="listitem">
              The second parameter to <code class="computeroutput"><span class="identifier">none_of_value</span></code>
              is a template parameter, rather than deduced from the first parameter
              (<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">InputIterator</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>) because that allows more
              flexibility for callers, and takes advantage of built-in comparisons
              for the type that is pointed to by the iterator. The function is defined
              to return true if, for all elements in the sequence, the expression
              <code class="computeroutput"><span class="special">*</span><span class="identifier">iter</span>
              <span class="special">==</span> <span class="identifier">val</span></code>
              evaluates to false (where <code class="computeroutput"><span class="identifier">iter</span></code>
              is an iterator to each element in the sequence)
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of" title="one_of">one_of</a>
</h4></div></div></div>
<p>
          The header file 'boost/algorithm/cxx11/one_of.hpp' contains four variants
          of a single algorithm, <code class="computeroutput"><span class="identifier">one_of</span></code>.
          The algorithm tests the elements of a sequence and returns true if exactly
          one of the elements in the sequence has a particular property.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">one_of</span></code> takes
          a sequence and a predicate. It will return true if the predicate returns
          true for one element in the sequence.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">one_of_equal</span></code>
          takes a sequence and a value. It will return true if one element in the
          sequence compares equal to the passed in value.
        </p>
<p>
          Both routines come in two forms; the first one takes two iterators to define
          the range. The second form takes a single range parameter, and uses Boost.Range
          to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.interface">interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">one_of</span></code> returns
          true if the predicate returns true for one item in the sequence. There
          are two versions; one takes two iterators, and the other takes a range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">one_of</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">one_of</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          The function <code class="computeroutput"><span class="identifier">one_of_equal</span></code>
          is similar to <code class="computeroutput"><span class="identifier">one_of</span></code>, but
          instead of taking a predicate to test the elements of the sequence, it
          takes a value to compare against.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">one_of_equal</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">V</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">one_of_equal</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">V</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="identifier">val</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>

<span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">algorithm</span><span class="special">;</span>
<span class="identifier">one_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">one_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">one_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">one_of</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>  <span class="comment">// empty range</span>
<span class="identifier">one_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">one_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="number">3</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">one_of_equal</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="number">99</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">one_of</span></code> and <code class="computeroutput"><span class="identifier">one_of_equal</span></code> work on all iterators except
          output iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.complexity">Complexity</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">one_of</span></code>
          and <code class="computeroutput"><span class="identifier">one_of_equal</span></code> run in
          <span class="emphasis"><em>O(N)</em></span> (linear) time; that is, they compare against
          each element in the list once. If more than one of the elements in the
          sequence satisfy the condition, then algorithm will return false immediately,
          without examining the remaining members of the sequence.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">one_of</span></code>
          and <code class="computeroutput"><span class="identifier">one_of_equal</span></code> take their
          parameters by value or const reference, and do not depend upon any global
          state. Therefore, all the routines in this file provide the strong exception
          guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.one_of.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              <code class="computeroutput"><span class="identifier">one_of</span></code> and <code class="computeroutput"><span class="identifier">one_of_equal</span></code> both return false for
              empty ranges, no matter what is passed to test against.
            </li>
<li class="listitem">
              The second parameter to <code class="computeroutput"><span class="identifier">one_of_equal</span></code>
              is a template parameter, rather than deduced from the first parameter
              (<code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">iterator_traits</span><span class="special">&lt;</span><span class="identifier">InputIterator</span><span class="special">&gt;::</span><span class="identifier">value_type</span></code>) because that allows more
              flexibility for callers, and takes advantage of built-in comparisons
              for the type that is pointed to by the iterator. The function is defined
              to return true if, for one element in the sequence, the expression
              <code class="computeroutput"><span class="special">*</span><span class="identifier">iter</span>
              <span class="special">==</span> <span class="identifier">val</span></code>
              evaluates to true (where <code class="computeroutput"><span class="identifier">iter</span></code>
              is an iterator to each element in the sequence)
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted" title="is_sorted">is_sorted
        </a>
</h4></div></div></div>
<p>
          The header file <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">algorithm</span><span class="special">/</span><span class="identifier">cxx11</span><span class="special">/</span><span class="identifier">is_sorted</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> contains functions for determining
          if a sequence is ordered.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.is_sorted"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.is_sorted">is_sorted</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">is_sorted</span><span class="special">(</span><span class="identifier">sequence</span><span class="special">)</span></code> determines whether or not a sequence is
          completely sorted according so some criteria. If no comparison predicate
          is specified, then <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span></code>
          is used (i.e, the test is to see if the sequence is non-decreasing)
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Pred</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_sorted</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Pred</span> <span class="identifier">p</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_sorted</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Pred</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_sorted</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Pred</span> <span class="identifier">p</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_sorted</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          Iterator requirements: The <code class="computeroutput"><span class="identifier">is_sorted</span></code>
          functions will work forward iterators or better.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.is_sorted_until"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.is_sorted_until">is_sorted_until</a>
        </h6>
<p>
          If <code class="computeroutput"><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first</span><span class="special">,</span> <span class="identifier">last</span><span class="special">)</span> <span class="special">&lt;</span> <span class="number">2</span></code>, then
          <code class="computeroutput"><span class="identifier">is_sorted</span> <span class="special">(</span>
          <span class="identifier">first</span><span class="special">,</span>
          <span class="identifier">last</span> <span class="special">)</span></code>
          returns <code class="computeroutput"><span class="identifier">last</span></code>. Otherwise,
          it returns the last iterator i in [first,last] for which the range [first,i)
          is sorted.
        </p>
<p>
          In short, it returns the element in the sequence that is "out of order".
          If the entire sequence is sorted (according to the predicate), then it
          will return <code class="computeroutput"><span class="identifier">last</span></code>.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Pred</span><span class="special">&gt;</span>
	<span class="identifier">FI</span> <span class="identifier">is_sorted_until</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Pred</span> <span class="identifier">p</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
	<span class="identifier">ForwardIterator</span> <span class="identifier">is_sorted_until</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Pred</span><span class="special">&gt;</span>
	<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">R</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">is_sorted_until</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Pred</span> <span class="identifier">p</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">&gt;</span>
	<span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="keyword">const</span> <span class="identifier">R</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">is_sorted_until</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          Iterator requirements: The <code class="computeroutput"><span class="identifier">is_sorted_until</span></code>
          functions will work on forward iterators or better. Since they have to
          return a place in the input sequence, input iterators will not suffice.
        </p>
<p>
          Complexity: <code class="computeroutput"><span class="identifier">is_sorted_until</span></code>
          will make at most <span class="emphasis"><em>N-1</em></span> calls to the predicate (given
          a sequence of length <span class="emphasis"><em>N</em></span>).
        </p>
<p>
          Examples:
        </p>
<p>
          Given the sequence <code class="computeroutput"><span class="special">{</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span>
          <span class="number">3</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="number">3</span> <span class="special">}</span></code>,
          <code class="computeroutput"><span class="identifier">is_sorted_until</span> <span class="special">(</span>
          <span class="identifier">beg</span><span class="special">,</span>
          <span class="identifier">end</span><span class="special">,</span>
          <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;())</span></code>
          would return an iterator pointing at the second <code class="computeroutput"><span class="number">3</span></code>.
        </p>
<p>
          Given the sequence <code class="computeroutput"><span class="special">{</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span>
          <span class="number">3</span><span class="special">,</span> <span class="number">4</span><span class="special">,</span> <span class="number">5</span><span class="special">,</span> <span class="number">9</span> <span class="special">}</span></code>,
          <code class="computeroutput"><span class="identifier">is_sorted_until</span> <span class="special">(</span>
          <span class="identifier">beg</span><span class="special">,</span>
          <span class="identifier">end</span><span class="special">,</span>
          <span class="identifier">std</span><span class="special">::</span><span class="identifier">less</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;())</span></code>
          would return <code class="computeroutput"><span class="identifier">end</span></code>.
        </p>
<p>
          There are also a set of "wrapper functions" for is_ordered which
          make it easy to see if an entire sequence is ordered. These functions return
          a boolean indicating success or failure rather than an iterator to where
          the out of order items were found.
        </p>
<p>
          To test if a sequence is increasing (each element at least as large as
          the preceding one):
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Iterator</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_increasing</span> <span class="special">(</span> <span class="identifier">Iterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">Iterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_increasing</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">R</span> <span class="special">&amp;</span><span class="identifier">range</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          To test if a sequence is decreasing (each element no larger than the preceding
          one):
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_decreasing</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_decreasing</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">R</span> <span class="special">&amp;</span><span class="identifier">range</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          To test if a sequence is strictly increasing (each element larger than
          the preceding one):
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_strictly_increasing</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_strictly_increasing</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">R</span> <span class="special">&amp;</span><span class="identifier">range</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          To test if a sequence is strictly decreasing (each element smaller than
          the preceding one):
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">algorithm</span> <span class="special">{</span>
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_strictly_decreasing</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span> <span class="special">);</span>
	
	<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_strictly_decreasing</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">R</span> <span class="special">&amp;</span><span class="identifier">range</span> <span class="special">);</span>
<span class="special">}}</span>
</pre>
<p>
        </p>
<p>
          Complexity: Each of these calls is just a thin wrapper over <code class="computeroutput"><span class="identifier">is_sorted</span></code>, so they have the same complexity
          as <code class="computeroutput"><span class="identifier">is_sorted</span></code>.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_sorted.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The routines <code class="computeroutput"><span class="identifier">is_sorted</span></code>
              and <code class="computeroutput"><span class="identifier">is_sorted_until</span></code>
              are part of the C++11 standard. When compiled using a C++11 implementation,
              the implementation from the standard library will be used.
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">is_sorted</span></code> and <code class="computeroutput"><span class="identifier">is_sorted_until</span></code> both return true
              for empty ranges and ranges of length one.
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned" title="is_partitioned">is_partitioned
        </a>
</h4></div></div></div>
<p>
          The header file 'is_partitioned.hpp' contains two variants of a single
          algorithm, <code class="computeroutput"><span class="identifier">is_partitioned</span></code>.
          The algorithm tests to see if a sequence is partitioned according to a
          predicate; in other words, all the items in the sequence that satisfy the
          predicate are at the beginning of the sequence.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">is_partitioned</span></code>
          takes a sequence and a predicate. It returns true if the sequence is partitioned
          according to the predicate.
        </p>
<p>
          <code class="computeroutput"><span class="identifier">is_partitioned</span></code> come in
          two forms; the first one takes two iterators to define the range. The second
          form takes a single range parameter, and uses Boost.Range to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.interface">interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">is_partitioned</span></code>
          returns true if the items in the sequence are separated according to their
          ability to satisfy the predicate. There are two versions; one takes two
          iterators, and the other takes a range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">InputIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">InputIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="keyword">bool</span> <span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>

<span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>
<span class="identifier">is_partitioned</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">is_partitioned</span></code> works on
          all iterators except output iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.complexity">Complexity</a>
        </h6>
<p>
          Both of the variants of <code class="computeroutput"><span class="identifier">is_partitioned</span></code>
          run in <span class="emphasis"><em>O(N)</em></span> (linear) time; that is, they compare against
          each element in the list once. If the sequence is found to be not partitioned
          at any point, the routine will terminate immediately, without examining
          the rest of the elements.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          Both of the variants of <code class="computeroutput"><span class="identifier">is_partitioned</span></code>
          take their parameters by value or const reference, and do not depend upon
          any global state. Therefore, all the routines in this file provide the
          strong exception guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_partitioned.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The iterator-based version of the routine <code class="computeroutput"><span class="identifier">is_partitioned</span></code>
              is also available as part of the C++11 standard.
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">is_partitioned</span></code> returns
              true for empty and single-element ranges, no matter what predicate
              is passed to test against.
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation" title="is_permutation">is_permutation
        </a>
</h4></div></div></div>
<p>
          The header file 'is_permutation.hpp' contains six variants of a single
          algorithm, <code class="computeroutput"><span class="identifier">is_permutation</span></code>.
          The algorithm tests to see if one sequence is a permutation of a second
          one; in other words, it contains all the same members, possibly in a different
          order.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">is_permutation</span></code>
          takes two sequences and an (optional) predicate. It returns true if the
          two sequences contain the same members. If it is passed a predicate, it
          uses the predicate to compare the elements of the sequence to see if they
          are the same.
        </p>
<p>
          <code class="computeroutput"><span class="identifier">is_permutation</span></code> come in
          three forms. The first one takes two iterators to define the first range,
          and the starting iterator of the second range. The second form takes a
          two iterators to define the first range and two more to define the second
          range. The third form takes a single range parameter, and uses Boost.Range
          to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.interface">Interface</a>
        </h6>
<p>
          The function <code class="computeroutput"><span class="identifier">is_permutation</span></code>
          returns true if the two input sequences contain the same elements. There
          are six versions; two take three iterators, two take four iterators, and
          the other two take two ranges.
        </p>
<p>
          In general, you should prefer the four iterator versions over the three
          iterator ones. The three iterator version has to "create" the
          fourth iterator internally by calling <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">advance</span><span class="special">(</span><span class="identifier">first2</span><span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">distance</span><span class="special">(</span><span class="identifier">first1</span><span class="special">,</span><span class="identifier">last1</span><span class="special">))</span></code>, and if the second sequence is shorter
          than the first, that's undefined behavior.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator2</span> <span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">last1</span><span class="special">,</span> <span class="identifier">ForwardIterator2</span> <span class="identifier">first2</span> <span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BinaryPredicate</span> <span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">last1</span><span class="special">,</span>
                      <span class="identifier">ForwardIterator2</span> <span class="identifier">first2</span><span class="special">,</span> <span class="identifier">BinaryPredicate</span> <span class="identifier">p</span> <span class="special">);</span>


<span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator2</span> <span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">last1</span><span class="special">,</span> <span class="identifier">ForwardIterator2</span> <span class="identifier">first2</span><span class="special">,</span> <span class="identifier">ForwardIterator2</span> <span class="identifier">last2</span> <span class="special">);</span>

<span class="keyword">template</span><span class="special">&lt;</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">ForwardIterator2</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">BinaryPredicate</span> <span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">first1</span><span class="special">,</span> <span class="identifier">ForwardIterator1</span> <span class="identifier">last1</span><span class="special">,</span>
                      <span class="identifier">ForwardIterator2</span> <span class="identifier">first2</span><span class="special">,</span> <span class="identifier">ForwardIterator2</span> <span class="identifier">last2</span><span class="special">,</span>
                      <span class="identifier">BinaryPredicate</span> <span class="identifier">p</span> <span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first2</span> <span class="special">);</span>

<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">BinaryPredicate</span><span class="special">&gt;</span>
<span class="keyword">bool</span> <span class="identifier">is_permutation</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first2</span><span class="special">,</span> <span class="identifier">BinaryPredicate</span> <span class="identifier">pred</span> <span class="special">);</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c1</span></code>
          containing <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          and <code class="computeroutput"><span class="identifier">c2</span></code> containing <code class="computeroutput"><span class="special">{</span> <span class="number">15</span><span class="special">,</span>
          <span class="number">14</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="number">2</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">c1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span>     <span class="identifier">c1</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">end</span> <span class="special">())</span> <span class="special">--&gt;</span> <span class="keyword">false</span>
<span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">c1</span><span class="special">.</span><span class="identifier">begin</span><span class="special">()</span> <span class="special">+</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">c1</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">end</span> <span class="special">())</span> <span class="special">--&gt;</span> <span class="keyword">true</span>

<span class="identifier">is_permutation</span> <span class="special">(</span> <span class="identifier">c1</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c1</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span> <span class="identifier">c2</span><span class="special">.</span><span class="identifier">end</span> <span class="special">())</span> <span class="special">--&gt;</span> <span class="keyword">true</span>  <span class="comment">// all empty ranges are permutations of each other</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">is_permutation</span></code> works on
          forward iterators or better.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.complexity">Complexity</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">is_permutation</span></code>
          run in <span class="emphasis"><em>O(N^2)</em></span> (quadratic) time; that is, they compare
          against each element in the list (potentially) N times. If passed random-access
          iterators, <code class="computeroutput"><span class="identifier">is_permutation</span></code>
          can return quickly if the sequences are different sizes.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          All of the variants of <code class="computeroutput"><span class="identifier">is_permutation</span></code>
          take their parameters by value, and do not depend upon any global state.
          Therefore, all the routines in this file provide the strong exception guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.is_permutation.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The three iterator versions of the routine <code class="computeroutput"><span class="identifier">is_permutation</span></code>
              are also available as part of the C++11 standard.
            </li>
<li class="listitem">
              The four iterator versions of the routine <code class="computeroutput"><span class="identifier">is_permutation</span></code>
              are part of the proposed C++14 standard. When C++14 standard libraries
              become available, the implementation should be changed to use the implementation
              from the standard library (if available).
            </li>
<li class="listitem">
              <code class="computeroutput"><span class="identifier">is_permutation</span></code> returns
              true when passed a pair of empty ranges, no matter what predicate is
              passed to test with.
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point"></a><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point" title="partition_point">partition_point
        </a>
</h4></div></div></div>
<p>
          The header file 'partition_point.hpp' contains two variants of a single
          algorithm, <code class="computeroutput"><span class="identifier">partition_point</span></code>.
          Given a partitioned sequence and a predicate, the algorithm finds the partition
          point; i.e, the first element in the sequence that does not satisfy the
          predicate.
        </p>
<p>
          The routine <code class="computeroutput"><span class="identifier">partition_point</span></code>
          takes a partitioned sequence and a predicate. It returns an iterator which
          'points to' the first element in the sequence that does not satisfy the
          predicate. If all the items in the sequence satisfy the predicate, then
          it returns one past the final element in the sequence.
        </p>
<p>
          <code class="computeroutput"><span class="identifier">partition_point</span></code> come in
          two forms; the first one takes two iterators to define the range. The second
          form takes a single range parameter, and uses Boost.Range to traverse it.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h0"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.interface"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.interface">interface</a>
        </h6>
<p>
          There are two versions; one takes two iterators, and the other takes a
          range.
        </p>
<p>
</p>
<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">ForwardIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="identifier">ForwardIterator</span> <span class="identifier">partition_point</span> <span class="special">(</span> <span class="identifier">ForwardIterator</span> <span class="identifier">first</span><span class="special">,</span> <span class="identifier">ForwardIterator</span> <span class="identifier">last</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Range</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Predicate</span><span class="special">&gt;</span>
	<span class="identifier">boost</span><span class="special">::</span><span class="identifier">range_iterator</span><span class="special">&lt;</span><span class="identifier">Range</span><span class="special">&gt;</span> <span class="identifier">partition_point</span> <span class="special">(</span> <span class="keyword">const</span> <span class="identifier">Range</span> <span class="special">&amp;</span><span class="identifier">r</span><span class="special">,</span> <span class="identifier">Predicate</span> <span class="identifier">p</span> <span class="special">);</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h1"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.examples"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.examples">Examples</a>
        </h6>
<p>
          Given the container <code class="computeroutput"><span class="identifier">c</span></code> containing
          <code class="computeroutput"><span class="special">{</span> <span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span>
          <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">14</span><span class="special">,</span> <span class="number">15</span> <span class="special">}</span></code>,
          then
</p>
<pre class="programlisting"><span class="keyword">bool</span> <span class="identifier">lessThan10</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">&lt;</span> <span class="number">10</span><span class="special">;</span> <span class="special">}</span>
<span class="keyword">bool</span> <span class="identifier">isOdd</span> <span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span> <span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">i</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">;</span> <span class="special">}</span>

<span class="identifier">partition_point</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">,</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">4</span>  <span class="special">(</span><span class="identifier">pointing</span> <span class="identifier">at</span> <span class="number">14</span><span class="special">)</span>
<span class="identifier">partition_point</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">4</span>  <span class="special">(</span><span class="identifier">pointing</span> <span class="identifier">at</span> <span class="number">14</span><span class="special">)</span>
<span class="identifier">partition_point</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span><span class="special">,</span> <span class="identifier">lessThan10</span> <span class="special">)</span> <span class="special">-&gt;</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">begin</span> <span class="special">()</span> <span class="special">+</span> <span class="number">3</span> <span class="special">(</span><span class="identifier">end</span><span class="special">)</span>
<span class="identifier">partition_point</span> <span class="special">(</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">(),</span> <span class="identifier">isOdd</span> <span class="special">)</span> <span class="special">--&gt;</span> <span class="identifier">c</span><span class="special">.</span><span class="identifier">end</span> <span class="special">()</span>  <span class="comment">// empty range</span>
</pre>
<p>
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h2"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.iterator_requirements"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.iterator_requirements">Iterator
          Requirements</a>
        </h6>
<p>
          <code class="computeroutput"><span class="identifier">partition_point</span></code> requires
          forward iterators or better; it will not work on input iterators or output
          iterators.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h3"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.complexity"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.complexity">Complexity</a>
        </h6>
<p>
          Both of the variants of <code class="computeroutput"><span class="identifier">partition_point</span></code>
          run in <span class="emphasis"><em>O( log (N))</em></span> (logarithmic) time; that is, the
          predicate will be will be applied approximately <span class="emphasis"><em>log(N)</em></span>
          times. To do this, however, the algorithm needs to know the size of the
          sequence. For forward and bidirectional iterators, calculating the size
          of the sequence is an <span class="emphasis"><em>O(N)</em></span> operation.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h4"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.exception_safety"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.exception_safety">Exception
          Safety</a>
        </h6>
<p>
          Both of the variants of <code class="computeroutput"><span class="identifier">partition_point</span></code>
          take their parameters by value or const reference, and do not depend upon
          any global state. Therefore, all the routines in this file provide the
          strong exception guarantee.
        </p>
<h6>
<a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.h5"></a>
          <span class="phrase"><a name="the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.notes"></a></span><a class="link" href="CXX11.html#the_boost_algorithm_library.CXX11.CXX11_inner_algorithms.partition_point.notes">Notes</a>
        </h6>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
              The iterator-based version of the routine <code class="computeroutput"><span class="identifier">partition_point</span></code>
              is also available as part of the C++11 standard.
            </li>
<li class="listitem">
              For empty ranges, the partition point is the end of the range.
            </li>
</ul></div>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="algorithm.CXX11.CXX11_inner_algorithms.partition_copy"></a><a class="link" href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.partition_copy" title="partition_copy">partition_copy
        </a>
</h4></div></div></div>
<p>
          <span class="bold"><strong><code class="literal"><a class="link" href="../header/boost/algorithm/cxx11/partition_copy_hpp.html" title="Header &lt;boost/algorithm/cxx11/partition_copy.hpp&gt;">partition_copy</a>
          </code> </strong></span> Copy a subset of a sequence to a new sequence
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="algorithm.CXX11.CXX11_inner_algorithms.copy_if"></a><a class="link" href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.copy_if" title="copy_if">copy_if
        </a>
</h4></div></div></div>
<p>
          <span class="bold"><strong><code class="literal"><a class="link" href="../header/boost/algorithm/cxx11/copy_if_hpp.html" title="Header &lt;boost/algorithm/cxx11/copy_if.hpp&gt;">copy_if</a>
          </code> </strong></span> Copy a subset of a sequence to a new sequence
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="algorithm.CXX11.CXX11_inner_algorithms.copy_n"></a><a class="link" href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.copy_n" title="copy_n">copy_n
        </a>
</h4></div></div></div>
<p>
          <span class="bold"><strong><code class="literal"><a class="link" href="../header/boost/algorithm/cxx11/copy_n_hpp.html" title="Header &lt;boost/algorithm/cxx11/copy_n.hpp&gt;">copy_n</a>
          </code> </strong></span> Copy n items from one sequence to another
        </p>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="algorithm.CXX11.CXX11_inner_algorithms.iota"></a><a class="link" href="CXX11.html#algorithm.CXX11.CXX11_inner_algorithms.iota" title="iota">iota
        </a>
</h4></div></div></div>
<p>
          <span class="bold"><strong><code class="literal"><a class="link" href="../header/boost/algorithm/cxx11/iota_hpp.html" title="Header &lt;boost/algorithm/cxx11/iota.hpp&gt;">iota</a>
          </code> </strong></span> Generate an increasing series
        </p>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2010-2012 Marshall Clow<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../the_boost_algorithm_library/Searching/KnuthMorrisPratt.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="CXX14.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
